Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded contribution form #325

Merged
merged 19 commits into from
Sep 12, 2019
Merged

Embedded contribution form #325

merged 19 commits into from
Sep 12, 2019

Conversation

newick
Copy link
Member

@newick newick commented Jun 14, 2019

@JalilArfaoui
Copy link
Member

Thanks !

Can you rebase on develop @newick ?

@JalilArfaoui
Copy link
Member

I'm opening PRs directly in this branch to build upon your work @newick ....

@JalilArfaoui JalilArfaoui changed the title Style/embedded contribution form Embedded contribution form Jun 21, 2019
@JalilArfaoui JalilArfaoui assigned lutangar and JalilArfaoui and unassigned newick Jun 21, 2019
@bmenant
Copy link
Member

bmenant commented Jun 25, 2019

Actually, as @lutangar spotted in #332 we missed the contributor name field in the form. My fault I guess. 🙏

I added a comment in the Trello card: https://trello.com/c/wrkki02b/142-embedded-contribution-form-sendinblue-mailjet

@lutangar lutangar force-pushed the style/EmbeddedContributionForm branch 2 times, most recently from 8464bf2 to 72b1fdb Compare July 2, 2019 08:30
@lutangar lutangar force-pushed the style/EmbeddedContributionForm branch from 72b1fdb to 5aad906 Compare July 9, 2019 08:43
@lutangar lutangar force-pushed the style/EmbeddedContributionForm branch 3 times, most recently from 04ba976 to 6dfff98 Compare August 4, 2019 19:51
@lutangar
Copy link
Member

lutangar commented Aug 5, 2019

@bmenant we need a last functional review on this.

Copy link
Member

@JalilArfaoui JalilArfaoui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some functional comments:

It seems that we're missing some space between the 2 buttons :

image

I have a red message whereas I'm just typing for the first time and don't have any red field :

image

Otherwise, seems good 👍

Copy link
Member

@JalilArfaoui JalilArfaoui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some code comments ...

webpack.config.js Show resolved Hide resolved
src/components/atoms/Forms/Input/Input.ts Show resolved Hide resolved
src/app/utils/form/handleFormSubmit.ts Show resolved Hide resolved
src/app/utils/form/handleFormSubmit.ts Show resolved Hide resolved
@@ -0,0 +1,3 @@
export default interface Errors {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is FormError ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is in our domain, FormErrors is not.

Copy link
Member

@JalilArfaoui JalilArfaoui Aug 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except that, to me, what you are describing is a form error, not a general LMEM error.

Then maybe this should be outside app/lmem and be called FormErrors to be correct, no ?

Copy link
Member

@lutangar lutangar Aug 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/app/lmem/contribution/validate.ts and src/app/lmem/contribution/validate.ts can be used outside of a form context, but I could move validateForm.ts outside of lmem though.
The idea was to propose an Errors interface for validation errors of a "model". The name could be better though, smthing like ValidationErrors or ModelErrors or ModelValidationErrors. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I see what you're trying to do. Maybe ValidationErrors makes it more explicit then.

src/app/content/sagas/contribution.ts Outdated Show resolved Hide resolved
src/app/content/sagas/contribution.ts Show resolved Hide resolved
src/app/content/App/Notice/Details/withConnect.ts Outdated Show resolved Hide resolved
@lutangar lutangar force-pushed the style/EmbeddedContributionForm branch from a9422dd to 675f72e Compare August 16, 2019 09:25
@@ -1,4 +1,4 @@
import { PersistedState } from 'redux-persist/es/types';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WTF I just had this problem in another branch when attempting to push.... isn't that supposed to be in develop?

@@ -90,22 +89,28 @@ export const getFormRegisteredFields = (formName: string) => (
return R.path(['registeredFields'], form) || [];
};

const getFieldPathErrorMessage = (state: ContentState, formName: string) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}, {})
.filter(errorMessage => errorMessage);
};
): string[] =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

expect(validateContribution()).to.not.be.empty;
});
it('rejects empty contribution', () => {
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can still use ts-ignore after all?

@lutangar lutangar force-pushed the style/EmbeddedContributionForm branch from 54ba871 to 978ecfc Compare September 6, 2019 12:27
newick and others added 19 commits September 6, 2019 15:29
add intention selector
change cheap selector to efficient ones
add form elements
add intention selector
change cheap selector to efficient ones
add `onChange` handler on `IntentionSelector`
…ection

handle contribution form
1. Submit: sync validation only
2. Preview: show server error when failing
3. Submitted: removed the button to see the notice
fix preview overflow and background issues
try to clarify getFlatFormErrors
fix typings issues
functional style to validateContribution
@lutangar lutangar force-pushed the style/EmbeddedContributionForm branch from 978ecfc to b95b018 Compare September 6, 2019 14:44
@lutangar lutangar merged commit 111d5e2 into develop Sep 12, 2019
@bmenant bmenant deleted the style/EmbeddedContributionForm branch October 11, 2019 10:38
@bmenant
Copy link
Member

bmenant commented Oct 11, 2019

🎉 This PR is included in version 3.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants